/* 电商管理后台全局样式 */

/* 引入Google字体 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* 全局重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    overflow-x: hidden;
}

/* 主容器布局 */
.main-container {
    display: flex;
    min-height: 100vh;
}

/* 内容区域 */
.content {
    flex: 1;
    padding: 20px;
    margin-left: 240px;
    transition: margin-left 0.3s ease;
}

.content.sidebar-closed {
    margin-left: 60px;
}

/* 头部样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1a202c;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 搜索框样式 */
.search-box {
    position: relative;
}

.search-box input {
    padding: 10px 15px 10px 40px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    width: 300px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

/* 用户资料样式 */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-profile:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a6cf7, #7b93ff);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
    font-size: 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.user-role {
    font-size: 12px;
    color: #999;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: #4a6cf7;
    color: white;
}

.btn-primary:hover {
    background: #3a5ae8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
}

.btn-secondary {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-success {
    background: #2ecc71;
    color: white;
}

.btn-success:hover {
    background: #27ae60;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

/* 卡片样式 */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    padding: 24px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
}

/* 网格布局 */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* 统计卡片样式 */
.stats-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stats-card .icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
}

.stats-card .icon.primary {
    background: rgba(74, 108, 247, 0.1);
    color: #4a6cf7;
}

.stats-card .icon.success {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.stats-card .icon.warning {
    background: rgba(241, 196, 15, 0.1);
    color: #f1c40f;
}

.stats-card .icon.danger {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.stats-card .value {
    font-size: 32px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 5px;
}

.stats-card .label {
    font-size: 14px;
    color: #999;
    margin-bottom: 10px;
}

.stats-card .change {
    font-size: 12px;
    font-weight: 500;
}

.stats-card .change.positive {
    color: #2ecc71;
}

.stats-card .change.negative {
    color: #e74c3c;
}

/* 表格容器样式 */
.table-container {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
}

.table-actions {
    display: flex;
    gap: 10px;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
}

th {
    font-weight: 600;
    color: #666;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #f8f9fa;
}

td {
    font-size: 14px;
    color: #333;
}

tr:hover {
    background: #f8f9fa;
}

/* 徽章样式 */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-primary {
    background: rgba(74, 108, 247, 0.1);
    color: #4a6cf7;
}

.badge-success {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

.badge-warning {
    background: rgba(241, 196, 15, 0.1);
    color: #f1c40f;
}

.badge-danger {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.badge-secondary {
    background: rgba(149, 165, 166, 0.1);
    color: #95a5a6;
}

.badge-info {
    background: rgba(52, 152, 219, 0.1);
    color: #3498db;
}

/* 表单样式 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-select:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.pagination button {
    width: 36px;
    height: 36px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    border-color: #4a6cf7;
    color: #4a6cf7;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: #4a6cf7;
    color: white;
    border-color: #4a6cf7;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a202c;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/* 视图容器样式 */
.view {
    display: none;
}

.view.active {
    display: block;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .content {
        margin-left: 0;
        padding: 15px;
    }
    
    .content.sidebar-closed {
        margin-left: 0;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-box input {
        width: 200px;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
}

/* 图标样式 */
.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-search::before {
    content: '🔍';
}

.icon-plus::before {
    content: '+';
}

.icon-download::before {
    content: '⬇️';
}

/* 工具提示样式 */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4a6cf7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #666;
}

.empty-state p {
    font-size: 14px;
}

/* 库存管理特定样式 */
.alerts-list {
    max-height: 300px;
    overflow-y: auto;
}

.alert-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fff5f5;
    transition: all 0.3s ease;
}

.alert-card:hover {
    background: #fff0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.alert-content h4 {
    font-size: 14px;
    margin-bottom: 5px;
    color: #333;
}

.alert-content p {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.alert-stock-info {
    display: flex;
    gap: 10px;
    font-size: 12px;
}

.alert-stock-level {
    font-weight: 500;
    color: #e74c3c;
}

/* 库存状态行样式 */
.status-normal {
    background-color: rgba(46, 204, 113, 0.05);
}

.status-low {
    background-color: rgba(241, 196, 15, 0.05);
}

.status-warning {
    background-color: rgba(231, 76, 60, 0.05);
}

.status-out {
    background-color: rgba(149, 165, 166, 0.05);
}

.stock-quantity {
    font-weight: 600;
}

/* 详情项样式 */
.detail-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* 按钮尺寸变体 */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}